﻿/**
 * 
 * @file FITKGlobalFrequencyDomain.h
 * @brief 全局频率范围
 * @author LiBaojun (libaojunqd@foxmail.com)
 * @date 2024-10-06
 * 
 */
#ifndef _FITKGLOBALFREQUENCE_DOMAIN_H___
#define _FITKGLOBALFREQUENCE_DOMAIN_H___

#include "FITKAcousticsPhysicsAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataObject.h"

namespace Acoustics
{
    /**
     * @brief 获取全局频率范围
     * @author LiBaojun (libaojunqd@foxmail.com)
     * @date 2024-10-06
     */
    class FITKAcousticsPhysicsAPI FITKGlobalFrequencyDomain :
        public Core::FITKAbstractDataObject
    {
        Q_OBJECT
        FITKCLASS(Acoustics, FITKGlobalFrequencyDomain);
    public:
        /**
         * @brief 频率范围类型
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        enum DomainType
        {
            DTNone,                    ///< 无
            DTStandardOctave,          ///< 标准信频
            DTStandard1Of3rdOctave,    ///< 标准1/3信频
            DTExact1OfnthOctave,       ///< 1/n信频
            DTConstantBandWidth,       ///< 固定带宽
        };
        Q_ENUM(DomainType);

    public:
        /**
         * @brief Construct a new FITKGlobalFrequencyDomain object
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        explicit FITKGlobalFrequencyDomain();
        /**
         * @brief Destroy the FITKGlobalFrequencyDomain object
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        virtual ~FITKGlobalFrequencyDomain() = default;
        /**
         * @brief 设置类型
         * @param[i]  t              类型
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        void setDomainType(DomainType t);
        /**
         * @brief 获取范围类型
         * @return DomainType 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        DomainType getDomainType();
        /**
         * @brief 获取频率列表
         * @return QList<double> 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        QList<double> getFrequenceList() const;
        /**
         * @brief 设置 Octave 数量
         * @param[i]  n              数量
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        void setOctaveNum(const int n);
        /**
         * @brief 获取Octave数量
         * @return int
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        int getOctaveNum() const;
        /**
         * @brief 设置起始频率
         * @param[i]  s            起始频率
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        void setStartFrequence(const double s);
        /**
         * @brief 获取起始频率
         * @return double
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        double getStartFrequence() const;
        /**
         * @brief 设置结束频率
         * @param[i]  e              结束频率
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        void setEndFrequence(const double e);
        /**
         * @brief 获取终止频率
         * @return double
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        double getEndFrequence() const;
        /**
         * @brief 设置带宽
         * @param[i]  w              带宽
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        void setBandWidth(const double w);
        /**
         * @brief 获取带宽
         * @return double
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-31
         */
        double getBandWidth() const;
    private:
        /**
         * @brief 标准信频的频率列表 
         * @return QList<double> 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        QList<double> getFrequenceListStandardOctave() const;
        /**
         * @brief 标准1/3信频的频率列表 
         * @return QList<double> 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        QList<double> getFrequenceListStandard1Of3rdOctave() const;
        /**
         * @brief 1/n信频的频率列表 
         * @return QList<double> 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        QList<double> getFrequenceListExact1OfnthOctave() const;
        /**
         * @brief 固定带宽的频率列表 
         * @return QList<double> 
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        QList<double> getFrequenceListConstantBandWidth() const;
    private:
        /**
         * @brief 类型
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        DomainType _domainType{ DTStandard1Of3rdOctave };
        /**
         * @brief 1/n Octave中的n
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        int _nthOctave{12};
        /**
         * @brief 起始频率
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        double _startFreq{ 63 };
        /**
         * @brief 最大频率
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        double _endFreq{ 8000 };
        /**
         * @brief 带宽
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-06
         */
        double _bandWidth{ 100 };
    };
}


#endif
